<template>
  <!-- 大学推荐列表 -->
  <div class="tabdetial">
    <Nav></Nav>
    <div class="banner-wrap">
      <img class="banner" :src="tabdetailBg" />
      <!-- <div class="btn">点击查看</div> -->
    </div>
    <div class="wrap">
      <div class="tabs">
        <div class="tabs-title">三位一体<span></span>大学推荐列表</div>
        <div class="tabs-subTitle">
          Gaobangbabg, paint a picture of life and draw a blueprint for the
          future.
        </div>
      </div>


      <div class="schools">
        <div
          class="schools-wrap"
          v-for="item in info"
          :key="item"
        >
          <schoolProject :introduce="item" :index="item.index"></schoolProject>
        </div>
      </div>

       <div class="page">
        <van-pagination
            v-model="currentPage"
            @change="changePage"
            :total-items="total"
            force-ellipses
            />
    </div>
     
    </div>
    <Footer></Footer>

   

  </div>
</template>

<script setup>
import Footer from '../../components/pc/Footer.vue';
import Nav from '../../components/pc/nav.vue';
import schoolProject from '../../components/pc/schoolProject.vue';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { getSchoolListPC } from '../../api/apiList/pcApi.js';
import tabdetailBg from '../../assets/pc/tabdetail-bg.png';
let info = ref({});
let currentIndex = ref(-1);

//分页参数
const currentPage = ref(1)
let total = ref('')
let limit = ref(10)

const route = useRoute();
const id = route.query.id;
onMounted(async () => {
  initList()
});
const changePage = () => {
  initList()
};

const initList = async ()=>{
   // 获取列表数据
  await getSchoolListPC({category_id:id}).then((res) => {
    const { result } = res;
    total.value = result.length;
    result.map((item,index)=>{
      Object.assign(item, {index});
    })
    info.value = []
    info.value = result.slice(limit.value * (currentPage.value - 1),limit.value * (currentPage.value - 1) + (limit.value));
 });
}
</script>

<style lang="less" scoped>
.tabdetial {
    .page {
        display: flex;
        align-items: flex-end;
        justify-content:flex-end;
    }
  .wrap {
    position: relative;
    width: 1201Px;
    margin: 0 auto;
    .tabs {
      margin-top: 40Px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      .tabs-title {
        display: flex;
        align-items: center;
        font-size: 28Px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #666666;
        line-height: 40Px;
        margin-bottom: 3Px;
        span {
          width: 12Px;
          height: 12Px;
          background: #d8d8d8;
          border-radius: 12Px;
          margin: 0 32Px;
        }
      }
      .tabs-subTitle {
        font-size: 22Px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999999;
        line-height: 30Px;
        margin-bottom: 37Px;
      }
    }
    .areas {
    .areas-item {
        display: flex;
        align-items: flex-start;
    }
      .title {
        font-size: 28Px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #000000;
        line-height: 40Px;
        margin-right: 20Px;
        flex: 0 0 140Px;
        margin-top:8Px;
      }
      .list {
        display: flex;
        flex-wrap: wrap;
        .item-active {
            background: linear-gradient(180deg, #EEEEEE 0%, #CCCDFF 100%);
            padding: 5Px;
        }
        .item {
            padding: 5Px;
          font-size: 20Px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #999999;
          line-height: 28Px;
          margin: 0 20Px;
          margin: 10Px;
          cursor: pointer;
        }
      }
      //  <div class="areas">
      //     <div class="title">地区选择:</div>
      //     <div class="list">
      //         <div class="item">全部</div>
      //          <div class="item">全部</div>
      //           <div class="item">全部</div>
      //     </div>
      //     <div class="title">年份选择:</div>
      //     <div class="list">
      //         <div class="item">全部</div>
      //          <div class="item">全部</div>
      //           <div class="item">全部</div>
      //     </div>
      //     <div class="title">分类选择:</div>
      //     <div class="list">
      //         <div class="item">全部</div>
      //          <div class="item">全部</div>
      //           <div class="item">全部</div>
      //     </div>
      // </div>
    }
  }
  .banner-wrap {
    position: relative;
    width: 100vw;
    height: auto;
  }
  .banner {
    width: 100vw;
    height: auto;
    margin-bottom: 30Px;
  }
}
</style>
